import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: resolve => require(['./App'], resolve),
      children: [
        {
          path: '/login',
          component: resolve => require(['page/login'], resolve)
        },
        {
          path: '/register',
          component: resolve => require(['page/register'], resolve)
        },
        {
          path: '/forgot',
          component: resolve => require(['page/forgotPwd'], resolve)
        },
        {
          path: '/',
          component: resolve => require(['page/index'], resolve)
        },
        // 投资产品详情
        {
          path: 'product',
          component: resolve => require(['page/product'], resolve)
        },
        // 智选智投
        {
          path: 'proarea',
          component: resolve => require(['page/productsArea'], resolve)
        },
        // 融资申请
        {
          path: 'finance',
          meta: {isAuth: true},
          component: resolve => require(['page/financeApply/index'], resolve)
        },
        // 融资申请-个人申请
        {
          path: 'papply',
          meta: {isAuth: true},
          component: resolve => require(['page/financeApply/personApply'], resolve)
        },
        // 融资申请-公司申请
        {
          path: 'capply',
          meta: {isAuth: true},
          component: resolve => require(['page/financeApply/componeyApply'], resolve)
        },
        // 我的账号
        {
          path: 'my',
          meta: {isAuth: true},
          component: resolve => require(['page/my/index'], resolve),
          children: [
            // 个人信息
            {
              path: '/',
              meta: {isAuth: true},
              component: resolve => require(['page/my/myAccount'], resolve)
            },
            // 实名认证
            {
              path: 'certification',
              meta: {isAuth: true},
              component: resolve => require(['page/my/certification'], resolve)
            },
            // 银行卡管理
            {
              path: 'cards',
              meta: {isAuth: true},
              component: resolve => require(['page/my/cardsMange'], resolve)
            },
            // 银行卡管理--新增、编辑
            {
              path: 'cardsinfo',
              meta: {isAuth: true},
              component: resolve => require(['page/my/isCardDetail'], resolve)
            },
            // 资金管理
            {
              path: 'capital',
              meta: {isAuth: true},
              component: resolve => require(['page/my/moneyManage'], resolve)
            },
            // 充值，提现；type：push充值，pull提现
            {
              path: 'recharge/:type',
              meta: {isAuth: true},
              component: resolve => require(['page/my/recharge'], resolve)
            },
            // 投资管理
            {
              path: 'investmentManage',
              meta: {isAuth: true},
              component: resolve => require(['page/my/investmentManage'], resolve)
            },
            // 我的融资
            {
              path: 'financing',
              meta: {isAuth: true},
              component: resolve => require(['page/my/myFinancing'], resolve)
            },
            // 邀请注册
            {
              path: 'invitation',
              meta: {isAuth: true},
              component: resolve => require(['page/my/invitation'], resolve)
            },
            // 账户安全
            {
              path: 'security',
              meta: {isAuth: true},
              component: resolve => require(['page/my/accountSecurity'], resolve)
            },
            // 账户安全--登录密码
            {
              path: 'loginPwd',
              meta: {isAuth: true},
              component: resolve => require(['page/my/loginPwd'], resolve)
            },
            // 账户安全--邮箱绑定
            {
              path: 'mail',
              meta: {isAuth: true},
              component: resolve => require(['page/my/mailBind'], resolve)
            },
            // 账户安全--手机号更改
            {
              path: 'phoneEdit',
              meta: {isAuth: true},
              component: resolve => require(['page/my/phoneEdit'], resolve)
            },
            // 账户安全--交易密码
            {
              path: 'tradePwd',
              meta: {isAuth: true},
              component: resolve => require(['page/my/tradePwd'], resolve)
            },
            // 账户安全--密保问题
            {
              path: 'safeQuestion',
              meta: {isAuth: true},
              component: resolve => require(['page/my/securityQuestion'], resolve)
            }
          ]
        },
        // 关于我们
        {
          path: 'about',
          component: resolve => require(['page/about/index'], resolve),
          children: [
            // 公司介绍
            {
              path: '/',
              component: resolve => require(['page/about/companyInfo'], resolve)
            },
            // 帮助中心
            {
              path: 'helpcenter',
              component: resolve => require(['page/about/helpCenter'], resolve)
            },
            // 帮助中心详情
            {
              path: 'helpcenter/:id',
              component: resolve => require(['page/about/helpDetail'], resolve)
            }
          ]
        }
      ]
    }
  ]
})
